package com.xish.api.activity.search.query;


import com.mysema.query.sql.MySQLTemplates;
import com.mysema.query.sql.SQLQuery;
import com.xish.api.activity.search.ActivitySearchCondition;
import com.xish.model.table.QWzmActivitySearch;

import java.util.List;

public class ActivityHighlightRuleThree extends ActivitySearchSqlQuery {

    public static final int limit = 3;

    public ActivityHighlightRuleThree(ActivitySearchCondition condition, List<Integer> excludeIdList) {
        super(condition, excludeIdList);
    }

    @Override
    public SQLQuery getSQLQuery() {
        SQLQuery query = new SQLQuery(new MySQLTemplates());

        query.from(QWzmActivitySearch.wzmActivitySearch)
                .where(status()
                        .and(isShowWeek())
                        .and(showEndTime())
                        .and(idNotIn(excludeIdList))
                        .and(showClose())
                        .and(showFar()))
                .orderBy(sortDistance())
                .limit(limit);

        return query;
    }
}
